<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>添加书籍</title>
    
    <link rel="stylesheet" href="css/edit.css">
</head>
<body>
    <div class="alert alert-success" th:if="${session.tips != null}">
        <strong th:text="${session.tips}">失败!</strong>
    </div>
    <h1>正在添加书籍. . .</h1>
    <form action="/appendBook" method="post">
        <label for="id">书号:</label>
        <input type="number" id="id" name="id" th:value="${session.editBookInfo.getBook_id()}" required><br><br>

        <label for="name">书名:</label>
        <input type="text" id="name" name="name" th:value="${session.editBookInfo.getBook_name()}" required><br><br>
        
        <label for="author">作者:</label>
        <input type="text" id="author" name="author" th:value="${session.editBookInfo.getBook_author()}" required><br><br>

        <label for="publisher">出版社:</label>
        <input type="text" id="publisher" name="publisher" th:value="${session.editBookInfo.getBook_publisher()}" required><br><br>

        <label for="type">类型:</label>
        <select id="type" name="type" required>
            <option th:value="${session.editBookInfo.getBook_type()}" th:text="${session.editBookInfoTypeName}" hidden></option>
            <option th:each="type : ${session.bookType}" th:value="${type.getType_id()}" th:text="${type.getType_name()}">选项</option>
        </select><br><br>
        
        <label for="date">入库时间:</label>
        <input type="date" id="date" name="date" th:value="${session.editBookInfo.getBook_date()}" required><br><br>

        <label for="count">数量:</label>
        <input type="number" id="count" name="count" th:value="${session.editBookInfo.getBook_count()}" required><br><br>

        <button type="submit">提交</button><button class="cancel" type="button" onclick="window.location.href='/editbook'">取消</button>
    </form>
</body>
<script src="js/operate.js"></script>
</html>
